<!-- 设备管理-设备采购-研学资讯 -->
<template>
  <div class="JNPF-common-layout">
    <div class="JNPF-common-layout-center">
      <el-row class="JNPF-common-search-box" :gutter="16">
        <el-form @submit.native.prevent>

          <el-col :span="10">
            <el-form-item label="日期">
              <el-date-picker v-model="fbillcredate" type="daterange" value-format="yyyy-MM-dd" range-separator="至"
                start-placeholder="开始日期" end-placeholder="结束日期">
              </el-date-picker>
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="资讯标题">
              <el-input v-model="listQuery.fcatname" placeholder="请输入编号或名称" clearable />
            </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="资讯栏目">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options1"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>
          
          <template v-if="showAll">
          
          <el-col :span="6">
           <el-form-item label="教育局">
            <el-select v-model="listQuery.fcustomno" placeholder="请选择"
              :disabled="$store.getters.userInfo.manufacturer">
              <el-option
                v-for="item in options1"
                :key="item.value"
                :label="item.label"
                :value="item.value">
              </el-option>
            </el-select>
          </el-form-item>
          </el-col>

          <el-col :span="6">
            <el-form-item label="发布状态">
              <el-select v-model="listQuery.fcustomno" placeholder="请选择"
                :disabled="$store.getters.userInfo.manufacturer">
                <el-option
                  v-for="item in options3"
                  :key="item.value"
                  :label="item.label"
                  :value="item.value">
                </el-option>
              </el-select>
            </el-form-item>
          </el-col>

          </template>

          <el-col :span="12">
            <el-form-item label="">
              <el-button type="primary" icon="el-icon-search" @click="getlist">查询</el-button>
              <el-button type="success" icon="el-icon-plus" @click="insert(undefined)">新增</el-button>
              <!-- <el-button type="warning" icon="el-icon-upload2">导入</el-button> -->
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>收起</el-button>
            </el-form-item>
          </el-col>
        </el-form>
      </el-row>
      <div class="JNPF-common-layout-main JNPF-flex-main">
        <JNPF-table :data="list" border v-loading="loading">
          <el-table-column prop="FCATTYPE" label="资讯栏目" width="95"></el-table-column>
          <el-table-column prop="FCATNO" label="资讯编号" width="95"></el-table-column>
          <el-table-column prop="FCATNAME" label="资讯标题" ></el-table-column>
          <el-table-column prop="FPOINT" label="教育局" width="105"></el-table-column>
          <el-table-column prop="FBEGDATE" label="显示起日" width="105"></el-table-column>
          <el-table-column prop="FENDDATE" label="显示讫日" width="105"></el-table-column>
          <el-table-column prop="FMEMO" label="备注"> </el-table-column>
          <el-table-column prop="FSTATE" label="状态" width="95"></el-table-column>
          <el-table-column fixed="left" label="操作" width="150">
            <template slot-scope="scope">
              <el-button @click.native.prevent="insert(scope.row.FCATNO)" icon="el-icon-edit" type="text" size="small">
                编辑
              </el-button>
              <el-popconfirm title="确定删除当前数据吗？" @confirm="Catdelete(scope.row.FCATNO)">
                <el-button slot="reference" icon="el-icon-delete" style="color: red;margin-left: 10px;"
                  type="text">通过</el-button>
              </el-popconfirm>
              <el-popconfirm title="确定删除当前数据吗？" @confirm="Catdelete(scope.row.FCATNO)">
                <el-button slot="reference" icon="el-icon-error" style="color: yellowgreen;margin-left: 10px;"
                  type="text">暂停</el-button>
              </el-popconfirm>
            </template>
          </el-table-column>
        </JNPF-table>
        <pagination :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" />
        <Form ref="Form" :parelist="list" />
      </div>
    </div>
  </div>
</template>

<script>
  import Form from "./Form.vue"
  import jnpf from "@/utils/jnpf"
  export default {
    name: 'shop',
    components: { Form },
    data() {
      return {
        showAll:false,
        total: 0,
        list: [
        {
          "FCATNO": "250430001",
          "FCATNAME": "传承耕读文化 践行育人初心",
          "FCATTYPE": "最新资讯",
          "FPOINT":"宝山教育局",
          "FBEGDATE":"2025-05-01",
          "FENDDATE":"2025-05-31",
          "FMEMO": "",
          "FSTATE": "未发布",
          "FOPERATOR": "system",
          "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
        },{
          "FCATNO": "250430002",
          "FCATNAME": "区域联动展风采 劳动体验促提升",
          "FCATTYPE": "最新资讯",
          "FPOINT":"宝山教育局",
          "FBEGDATE":"2025-05-01",
          "FENDDATE":"2025-05-31",
          "FMEMO": "",
          "FSTATE": "未发布",
          "FOPERATOR": "system",
          "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
        },{
          "FCATNO": "250430003",
          "FCATNAME": "研学旅行实践基地（地学类）名单公示",
          "FCATTYPE": "最新资讯",
          "FPOINT":"宝山教育局",
          "FBEGDATE":"2025-05-01",
          "FENDDATE":"2025-05-31",
          "FMEMO": "",
          "FSTATE": "未发布",
          "FOPERATOR": "system",
          "FUPDDATE": "2011-02-16T02:57:02.000+00:00"
        }
        ],

        //所属校区选择数据
        options1: [{
          value: '1',
          label: '最新资讯'
        }, {
          value: '2',
          label: '最新政策'
        }, {
          value: '3',
          label: '研学活动'
        }, {
          value: '4',
          label: '研学知识'
        }, {
          value: '5',
          label: '研学课堂'
        }],
        fbillcredate: [jnpf.dateFormat(new Date(), "YYYY-MM-DD"), jnpf.dateFormat(new Date(), "YYYY-MM-DD")],
        loading: false,
        listQuery: {
          page: 1,
          limit: 20,
          sort: "desc",
          sidx: "",
          fcatno: "",
          fcatname: ""
        },
      };
    },
    computed: {},
    created() {
    },
    methods: {
      insert(row) {
        this.$refs.Form.init(row);
      },
    },
  };
</script>